package ningbo.day04.basic;

import ningbo.day04.oop.TestVariable2;

import java.util.Scanner;

/**
 * @Author 宁铂
 * @Date 2021/7/18 10:21
 * @Version 1.0
 */
public class TestBreakAndContinue {
    /**需求：找数字88
     * 提示并接受用户输入100次数字，如果不是88，则继续输入，找到88就结束
     *  */
    public static void main(String[] args) {
        TestFor3();
    }

    private static void TestFor3() {

        for (int i = 99; i >= 1; i--){
            System.out.println("请输入数字:");
            int input = new Scanner(System.in).nextInt();
            if (input != 88){
                System.out.println("猜错了,你还有"+i+"次机会");
                continue;
            }

            if(input == 88){
                System.out.println("恭喜您猜对了!!");
                break;
            }
        }
    }
}
